package com.sks.bean.pojo;



import static javax.persistence.GenerationType.IDENTITY;

import javax.persistence.Entity;
import javax.persistence.FetchType;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.persistence.UniqueConstraint;


@Entity
@Table(name = "favorites", uniqueConstraints = { @UniqueConstraint(columnNames = { "f_id" }) })
public class Favorites implements java.io.Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = -7580023530950577734L;

	private Integer f_id;
	
	private Integer buildingId;
	
	private Integer houseId;
	
	private Integer userId;
	
	private Building building;
	
	private House house;
	
	private Users user;

	private String houseName;
	
	private String buildingName;

	public Favorites(Integer f_id, Building building, House house, Users user,String houseName,String buildingName ) {
		super();
		this.setF_id(f_id);
		this.building = building;
		this.house = house;
		this.user = user;
		this.houseName = houseName;
		this.buildingName = buildingName;
	}


	public Favorites() {
		// TODO Auto-generated constructor stub
	}


	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "f_id", unique = true, nullable = false)
	public Integer getF_id() {
		return f_id;
	}
	
	public void setF_id(Integer f_id) {
		this.f_id = f_id;
	}

	public void setUser(Users user) {
		this.user = user;
	}


	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumn(name = "userId", unique = true, nullable = true, insertable = true, updatable = true)
	public Users getUser() {
		return user;
	}


	public void setHouse(House house) {
		this.house = house;
	}


	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumn(name = "houseId", unique = true, nullable = true, insertable = true, updatable = true)
	public House getHouse() {
		return house;
	}


	public void setBuilding(Building building) {
		this.building = building;
	}


	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumn(name = "buildingId", unique = true, nullable = true, insertable = true, updatable = true)
	public Building getBuilding() {
		return building;
	}


	@Transient
	public Integer getBuildingId() {
		return buildingId;
	}


	public void setBuildingId(Integer buildingId) {
		this.buildingId = buildingId;
	}


	@Transient
	public Integer getHouseId() {
		return houseId;
	}


	public void setHouseId(Integer houseId) {
		this.houseId = houseId;
	}


	@Transient
	public Integer getUserId() {
		return userId;
	}


	public void setUserId(Integer userId) {
		this.userId = userId;
	}


	public void setHouseName(String houseName) {
		this.houseName = houseName;
	}


	@Column(name = "houseName", unique = false, nullable = true, insertable = true, updatable = true, length = 100)
	public String getHouseName() {
		return houseName;
	}


	public void setBuildingName(String buildingName) {
		this.buildingName = buildingName;
	}


	@Column(name = "buildingName", unique = false, nullable = true, insertable = true, updatable = true, length = 100)
	public String getBuildingName() {
		return buildingName;
	}

	

}
